/*
 * main.cpp
 *
 *  Created on: 2011-10-22
 *      Author: mateusz
 */

#include <cstdio>
#include <vector>
#include <algorithm>

#include "Config.h"
#include "Depot.h"
#include "Customers.h"
#include "Parser.h"
#include "CVRP.h"

using namespace std;

const int INFTY = 1000000001;
#define EPS 10e-9

Depot* depot;
Customers* customers = new Customers();
Parser* p = new Parser();

bool cmp(Customer* a, Customer* b) {
	return a->getDepotDistance() < b->getDepotDistance();
}

int main(int argc, char* argv[]) {
	Config* config = new Config();

	// make config
	config->build(argc, argv);

	// load data from inupt file (stdin if not configured)
	p->loadData(config->getInputFile(), config->getMaxCustomers());

	// process CVRP
	p->startSaving(config->getOutputFile());
	CVRP::process(config->getRunTime());
	p->stopSaving(config->getOutputFile());

	// at the end - delete all created instances
	delete p;
	delete config;
	delete customers;
	delete depot;

	return 0;
}
